package cn.hxzy.commonUser.controller;


import cn.hxzy.common.Result;
import cn.hxzy.commonUser.service.BankAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ao.Li
 * @since 2023-06-23
 */
@CrossOrigin
@RestController
@RequestMapping("/ttBankAccount")
public class BankAccountController {

    @Autowired
    private BankAccountService bankAccountService;

    @GetMapping("/selectBankByUserId/{userId}/{pwd}/{money}")
    public Result selectBankByUserId(@PathVariable String userId,@PathVariable int pwd,@PathVariable Double money) {
        Boolean aBoolean = bankAccountService.selectBankByUserId(userId, pwd, money);
        if (aBoolean)  return Result.ok().message("正确执行").data1(true);
        return Result.error().message("执行失败").data1(false);
    }

    /**
     * 修改支付密码
     * @param userId
     * @param oldPwd
     * @param newPwd
     * @return
     */
    @GetMapping("/updatePayPwdById/{userId}/{oldPwd}/{newPwd}")
    public Result updatePayPwdById(@PathVariable String userId,@PathVariable  int oldPwd,@PathVariable  int newPwd) {
        Boolean flag = bankAccountService.updatePayPwdById(userId, oldPwd, newPwd);
        if (flag) return Result.ok().message("修改支付密码成功");
        return Result.error().message("修改支付密码失败");
    }
}

